package top.tangyh.lamp.care.service.impl;

import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import top.tangyh.lamp.care.common.YclTreeUtil;
import top.tangyh.lamp.care.entity.BYcAssessmentDict;
import top.tangyh.lamp.care.mapper.BYcAssessmentDictMapper;
import top.tangyh.lamp.care.mapper.BYcDadDictMapper;
import top.tangyh.lamp.care.service.BYcDadDictService;
import top.tangyh.basic.base.service.impl.SuperServiceImpl;
import top.tangyh.lamp.care.manager.BYcDadDictManager;
import top.tangyh.lamp.care.entity.BYcDadDict;
import top.tangyh.lamp.care.vo.result.AssessmentOutVO;
import top.tangyh.lamp.care.vo.result.PingGuOutVO;
import top.tangyh.lamp.care.vo.save.BYcDadDictSaveVO;
import top.tangyh.lamp.care.vo.update.BYcDadDictUpdateVO;
import top.tangyh.lamp.care.vo.result.BYcDadDictResultVO;
import top.tangyh.lamp.care.vo.query.BYcDadDictPageQuery;

import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 业务实现类
 * 压疮评估项目字典表
 * </p>
 *
 * @author zqb
 * @date 2024-07-16 14:57:44
 * @create [2024-07-16 14:57:44] [zqb] [代码生成器生成]
 */
@Slf4j
@RequiredArgsConstructor
@Service
@Transactional(readOnly = true)
public class BYcDadDictServiceImpl  implements BYcDadDictService {


    private final BYcDadDictMapper bYcDadDictMapper;

    private final BYcAssessmentDictMapper bYcAssessmentDictMapper;
    @Override
    public PingGuOutVO selectYcPingGuData() {

        PingGuOutVO ycPingGuOutVO = new PingGuOutVO();
        //评估项目字典树形列表
        List<BYcDadDict> yxYcDadDictList = bYcDadDictMapper.selectList(null);
        List<BYcDadDict> dictTreeList = YclTreeUtil.makeTreeList(yxYcDadDictList);
        ycPingGuOutVO.setTemplateEditorList(dictTreeList);
        //评估标准相关内容
        AssessmentOutVO assessmentOutVO = new AssessmentOutVO();
        List<BYcAssessmentDict> yxYcAssessmentList = bYcAssessmentDictMapper.selectList(null);
        assessmentOutVO.setList(yxYcAssessmentList);
        String daRemark = yxYcAssessmentList.stream().map(BYcAssessmentDict::getDaRemark).filter(StrUtil::isNotBlank).collect(Collectors.joining(","));
        assessmentOutVO.setDaRemark(daRemark);

        ycPingGuOutVO.setDicAssessmentPropList(assessmentOutVO);
        return ycPingGuOutVO;
    }
}


